﻿//////////////////////////////////////////////////////////////////////////
// FileName:Driver.cs
// CreateBy:DragonXiong
// CreateDate:2010-5-21
// Description:
//		Drivers class
//
// Modify Log:
//
// Copyright:ASL
/////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Auto.Components;

namespace Auto.Data.BusMan.Model
{
    [Serializable]
    public class Drivers
    {
        #region --Field--
        ///<summary>
        ///Data Table Bus_Drivers
        ///</summary>
        public const string TABLENAME_Bus_Drivers = "Bus_Drivers";
        /// <sumary> 
        /// (RecID Type:Int Len:0) 
        /// </sumary> 
        public const string FIELD_RecID = "RecID";
        /// <sumary> 
        /// (DriverID Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_DriverID = "DriverID";
        /// <sumary> 
        /// (DriverName Type:NVarChar Len:20) 
        /// </sumary> 
        public const string FIELD_DriverName = "DriverName";
        /// <sumary> 
        /// (DriverName Type:NVarChar Len:100) 
        /// </sumary> 
        public const string FIELD_DriverPic = "DriverPic";
        /// <sumary> 
        /// (CompanyID Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_CompanyID = "CompanyID";
        /// <sumary> 
        /// (CompanyName Type:NVarChar Len:50) 
        /// </sumary> 
        public const string FIELD_CompanyName = "CompanyName";
        /// <sumary> 
        /// (Sex Type:NChar Len:1) 
        /// </sumary> 
        public const string FIELD_Sex = "Sex";
        /// <sumary> 
        /// (BirthDay Type:SmallDateTime Len:0) 
        /// </sumary> 
        public const string FIELD_BirthDay = "BirthDay";
        /// <sumary> 
        /// (FamilyAddress Type:NVarChar Len:50) 
        /// </sumary> 
        public const string FIELD_FamilyAddress = "FamilyAddress";
        /// <sumary> 
        /// (CellPhone Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_CellPhone = "CellPhone";
        /// <sumary> 
        /// (HomePhone Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_HomePhone = "HomePhone";
        /// <sumary> 
        /// (IDCardNO Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_IDCardNO = "IDCardNO";
        /// <sumary> 
        /// (DrivingLicenseType Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_DrivingLicenseType = "DrivingLicenseType";
        /// <sumary> 
        /// (DrivingLicenseGetDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public const string FIELD_DrivingLicenseGetDate = "DrivingLicenseGetDate";
        /// <sumary> 
        /// (BusIdentificationNO Type:NVarChar Len:50) 
        /// </sumary> 
        public const string FIELD_BusIdentificationNO = "BusIdentificationNO";
        /// <sumary> 
        /// (WorkCompany Type:NVarChar Len:50) 
        /// </sumary> 
        public const string FIELD_WorkCompany = "WorkCompany";
        /// <sumary> 
        /// (WorkType Type:NVarChar Len:20) 
        /// </sumary> 
        public const string FIELD_WorkType = "WorkType";
        /// <sumary> 
        /// (IDCardNOPic Type:NVarChar Len:100) 
        /// </sumary> 
        public const string FIELD_IDCardNOPic = "IDCardNOPic";
        /// <sumary> 
        /// (DrivingLicense Type:NVarChar Len:100) 
        /// </sumary> 
        public const string FIELD_DrivingLicense = "DrivingLicense";
        /// <sumary> 
        /// (DrivingPermit Type:NVarChar Len:100) 
        /// </sumary> 
        public const string FIELD_DrivingPermit = "DrivingPermit";
        /// <sumary> 
        /// (OperationCertificate Type:NVarChar Len:100) 
        /// </sumary> 
        public const string FIELD_OperationCertificate = "OperationCertificate";
        /// <sumary> 
        /// (SpecialCertificate Type:NVarChar Len:100) 
        /// </sumary> 
        public const string FIELD_SpecialCertificate = "SpecialCertificate";
        /// <sumary> 
        /// (PoliceStationCertificate Type:NVarChar Len:100) 
        /// </sumary> 
        public const string FIELD_PoliceStationCertificate = "PoliceStationCertificate";
        /// <sumary> 
        /// (Contract Type:NVarChar Len:100) 
        /// </sumary> 
        public const string FIELD_Contract = "Contract";
        /// <sumary> 
        /// (ContractDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public const string FIELD_ContractDate = "ContractDate";
        /// <sumary> 
        /// (ContractCycle Type:Int Len:0) 
        /// </sumary> 
        public const string FIELD_ContractCycle = "ContractCycle";
        /// <sumary> 
        /// (SecurityAgreementDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public const string FIELD_SecurityAgreementDate = "SecurityAgreementDate";
        /// <sumary> 
        /// (SecurityAgreementCycle Type:Int Len:0) 
        /// </sumary> 
        public const string FIELD_SecurityAgreementCycle = "SecurityAgreementCycle";
        /// <sumary> 
        /// (HealthDeclareForm Type:NVarChar Len:100) 
        /// </sumary> 
        public const string FIELD_HealthDeclareForm = "HealthDeclareForm";
        /// <sumary> 
        /// (HealthDeclareDate Type:NVarChar Len:100) 
        /// </sumary> 
        public const string FIELD_HealthDeclareDate = "HealthDeclareDate";
        /// <sumary> 
        /// (Guarantor Type:NVarChar Len:50) 
        /// </sumary> 
        public const string FIELD_Guarantor = "Guarantor";
        /// <sumary> 
        /// (RecDivID Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_RecDivID = "RecDivID";
        /// <sumary> 
        /// (RecAcct Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_RecAcct = "RecAcct";
        /// <sumary> 
        /// (RecDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public const string FIELD_RecDate = "RecDate";
        /// <sumary> 
        /// (Void Type:Bit Len:0) 
        /// </sumary> 
        public const string FIELD_Void = "Void";
        /// <sumary> 
        /// (VoidAcct Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_VoidAcct = "VoidAcct";
        /// <sumary> 
        /// (VoidDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public const string FIELD_VoidDate = "VoidDate";
        /// <sumary> 
        /// (UserAcct Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_UserAcct = "UserAcct";
        /// <sumary> 
        /// (LastUpdateDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public const string FIELD_LastUpdateDate = "LastUpdateDate";
        #endregion --Field--

        #region --Property--
        private int _recid;
        private string _driverid;
        private string _drivername;
        private string _driverpic;
        private string _companyid;
        private string _companyname;
        private string _sex;
        private DateTime _birthday;
        private string _familyaddress;
        private string _cellphone;
        private string _homephone;
        private string _idcardno;
        private string _drivinglicensetype;
        private DateTime _drivinglicensegetdate;
        private string _busidentificationno;
        private string _workcompany;
        private string _worktype;
        private string _idcardnopic;
        private string _drivinglicense;
        private string _drivingpermit;
        private string _operationcertificate;
        private string _specialcertificate;
        private string _policestationcertificate;
        private string _contract;
        private DateTime? _contractdate;
        private int _contractcycle;
        private DateTime? _securityagreementdate;
        private int _securityagreementcycle;
        private string _healthdeclareform;
        private DateTime _healthdeclaredate;
        private string _guarantor;
        private string _recdivid;
        private string _recacct;
        private DateTime _recdate;
        private bool _void;
        private string _voidacct;
        private DateTime _voiddate;
        private string _useracct;
        private DateTime _lastupdatedate;

        /// <sumary> 
        /// (RecID Type:Int Len:0) 
        /// </sumary> 
        public int RecID
        {
            set { _recid = value; }
            get { return _recid; }
        }

        /// <sumary> 
        /// (DriverID Type:VarChar Len:20) 
        /// </sumary> 
        public string DriverID
        {
            set { _driverid = value; }
            get { return _driverid; }
        }

        /// <sumary> 
        /// (DriverName Type:NVarChar Len:20) 
        /// </sumary> 
        public string DriverName
        {
            set { _drivername = value; }
            get { return _drivername; }
        }

        /// <sumary> 
        /// (DriverName Type:NVarChar Len:100) 
        /// </sumary> 
        public string DriverPic
        {
            set { _driverpic = value; }
            get { return _driverpic; }
        }
        /// <sumary> 
        /// (CompanyID Type:VarChar Len:20) 
        /// </sumary> 
        public string CompanyID
        {
            set { _companyid = value; }
            get { return _companyid; }
        }

        /// <sumary> 
        /// (CompanyName Type:NVarChar Len:50) 
        /// </sumary> 
        public string CompanyName
        {
            set { _companyname = value; }
            get { return _companyname; }
        }

        /// <sumary> 
        /// (Sex Type:NChar Len:1) 
        /// </sumary> 
        public string Sex
        {
            set { _sex = value; }
            get { return _sex; }
        }

        /// <sumary> 
        /// (BirthDay Type:SmallDateTime Len:0) 
        /// </sumary> 
        public DateTime BirthDay
        {
            set { _birthday = value; }
            get { return _birthday; }
        }

        /// <sumary> 
        /// (FamilyAddress Type:NVarChar Len:50) 
        /// </sumary> 
        public string FamilyAddress
        {
            set { _familyaddress = value; }
            get { return _familyaddress; }
        }

        /// <sumary> 
        /// (CellPhone Type:VarChar Len:20) 
        /// </sumary> 
        public string CellPhone
        {
            set { _cellphone = value; }
            get { return _cellphone; }
        }

        /// <sumary> 
        /// (HomePhone Type:VarChar Len:20) 
        /// </sumary> 
        public string HomePhone
        {
            set { _homephone = value; }
            get { return _homephone; }
        }

        /// <sumary> 
        /// (IDCardNO Type:VarChar Len:20) 
        /// </sumary> 
        public string IDCardNO
        {
            set { _idcardno = value; }
            get { return _idcardno; }
        }

        /// <sumary> 
        /// (DrivingLicenseType Type:VarChar Len:20) 
        /// </sumary> 
        public string DrivingLicenseType
        {
            set { _drivinglicensetype = value; }
            get { return _drivinglicensetype; }
        }

        /// <sumary> 
        /// (DrivingLicenseGetDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public DateTime DrivingLicenseGetDate
        {
            set { _drivinglicensegetdate = value; }
            get { return _drivinglicensegetdate; }
        }

        /// <sumary> 
        /// (BusIdentificationNO Type:NVarChar Len:50) 
        /// </sumary> 
        public string BusIdentificationNO
        {
            set { _busidentificationno = value; }
            get { return _busidentificationno; }
        }

        /// <sumary> 
        /// (WorkCompany Type:NVarChar Len:50) 
        /// </sumary> 
        public string WorkCompany
        {
            set { _workcompany = value; }
            get { return _workcompany; }
        }

        /// <sumary> 
        /// (WorkType Type:NVarChar Len:20) 
        /// </sumary> 
        public string WorkType
        {
            set { _worktype = value; }
            get { return _worktype; }
        }

        /// <sumary> 
        /// (IDCardNOPic Type:NVarChar Len:100) 
        /// </sumary> 
        public string IDCardNOPic
        {
            set { _idcardnopic = value; }
            get { return _idcardnopic; }
        }

        /// <sumary> 
        /// (DrivingLicense Type:NVarChar Len:100) 
        /// </sumary> 
        public string DrivingLicense
        {
            set { _drivinglicense = value; }
            get { return _drivinglicense; }
        }

        /// <sumary> 
        /// (DrivingPermit Type:NVarChar Len:100) 
        /// </sumary> 
        public string DrivingPermit
        {
            set { _drivingpermit = value; }
            get { return _drivingpermit; }
        }

        /// <sumary> 
        /// (OperationCertificate Type:NVarChar Len:100) 
        /// </sumary> 
        public string OperationCertificate
        {
            set { _operationcertificate = value; }
            get { return _operationcertificate; }
        }

        /// <sumary> 
        /// (SpecialCertificate Type:NVarChar Len:100) 
        /// </sumary> 
        public string SpecialCertificate
        {
            set { _specialcertificate = value; }
            get { return _specialcertificate; }
        }

        /// <sumary> 
        /// (PoliceStationCertificate Type:NVarChar Len:100) 
        /// </sumary> 
        public string PoliceStationCertificate
        {
            set { _policestationcertificate = value; }
            get { return _policestationcertificate; }
        }

        /// <sumary> 
        /// (Contract Type:NVarChar Len:100) 
        /// </sumary> 
        public string Contract
        {
            set { _contract = value; }
            get { return _contract; }
        }

        /// <sumary> 
        /// (ContractDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public DateTime? ContractDate
        {
            set { _contractdate = value; }
            get { return _contractdate; }
        }

        /// <sumary> 
        /// (ContractCycle Type:Int Len:0) 
        /// </sumary> 
        public int ContractCycle
        {
            set { _contractcycle = value; }
            get { return _contractcycle; }
        }

        /// <sumary> 
        /// (SecurityAgreementDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public DateTime? SecurityAgreementDate
        {
            set { _securityagreementdate = value; }
            get { return _securityagreementdate; }
        }

        /// <sumary> 
        /// (SecurityAgreementCycle Type:Int Len:0) 
        /// </sumary> 
        public int SecurityAgreementCycle
        {
            set { _securityagreementcycle = value; }
            get { return _securityagreementcycle; }
        }

        /// <sumary> 
        /// (HealthDeclareForm Type:NVarChar Len:100) 
        /// </sumary> 
        public string HealthDeclareForm
        {
            set { _healthdeclareform = value; }
            get { return _healthdeclareform; }
        }

        /// <sumary> 
        /// (HealthDeclareDate Type:smalldatetime Len:0) 
        /// </sumary> 
        public DateTime HealthDeclareDate
        {
            set { _healthdeclaredate = value; }
            get { return _healthdeclaredate; }
        }

        /// <sumary> 
        /// (Guarantor Type:NVarChar Len:50) 
        /// </sumary> 
        public string Guarantor
        {
            set { _guarantor = value; }
            get { return _guarantor; }
        }

        /// <sumary> 
        /// (RecDivID Type:VarChar Len:20) 
        /// </sumary> 
        public string RecDivID
        {
            set { _recdivid = value; }
            get { return _recdivid; }
        }

        /// <sumary> 
        /// (RecAcct Type:VarChar Len:20) 
        /// </sumary> 
        public string RecAcct
        {
            set { _recacct = value; }
            get { return _recacct; }
        }

        /// <sumary> 
        /// (RecDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public DateTime RecDate
        {
            set { _recdate = value; }
            get { return _recdate; }
        }

        /// <sumary> 
        /// (Void Type:Bit Len:0) 
        /// </sumary> 
        public bool Void
        {
            set { _void = value; }
            get { return _void; }
        }

        /// <sumary> 
        /// (VoidAcct Type:VarChar Len:20) 
        /// </sumary> 
        public string VoidAcct
        {
            set { _voidacct = value; }
            get { return _voidacct; }
        }

        /// <sumary> 
        /// (VoidDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public DateTime VoidDate
        {
            set { _voiddate = value; }
            get { return _voiddate; }
        }

        /// <sumary> 
        /// (UserAcct Type:VarChar Len:20) 
        /// </sumary> 
        public string UserAcct
        {
            set { _useracct = value; }
            get { return _useracct; }
        }

        /// <sumary> 
        /// (LastUpdateDate Type:SmallDateTime Len:0) 
        /// </sumary> 
        public DateTime LastUpdateDate
        {
            set { _lastupdatedate = value; }
            get { return _lastupdatedate; }
        }

        #endregion --Property--

        #region --New--
        /// <summary>
        /// Constructed Function
        /// </summary>
        public Drivers()
        {
            Init();
        }
        /// <summary>
        /// Constructed Function
        /// </summary>
        /// <param name="dr">DataRow</param>
        public Drivers(DataRow dr)
        {
            Init();
            SetModel(dr);
        }
        /// <summary>
        /// Constructed Function
        /// </summary>
        /// <param name="dt">DataTable</param>
        public Drivers(DataTable dt)
        {
            Init();
            SetModel(dt);
        }
        #endregion --New--

        #region --Private--
        /// <summary>
        /// Init The Private variable
        /// </summary>
        private void Init()
        {
            _recid = 0;
            _driverid = string.Empty;
            _drivername = string.Empty;
            _driverpic = string.Empty;
            _companyid = string.Empty;
            _companyname = string.Empty;
            _sex = string.Empty;
            _birthday = DateTime.MinValue;
            _familyaddress = string.Empty;
            _cellphone = string.Empty;
            _homephone = string.Empty;
            _idcardno = string.Empty;
            _drivinglicensetype = string.Empty;
            _drivinglicensegetdate = DateTime.MinValue;
            _busidentificationno = string.Empty;
            _workcompany = string.Empty;
            _worktype = string.Empty;
            _idcardnopic = string.Empty;
            _drivinglicense = string.Empty;
            _drivingpermit = string.Empty;
            _operationcertificate = string.Empty;
            _specialcertificate = string.Empty;
            _policestationcertificate = string.Empty;
            _contract = string.Empty;
            _contractdate = DateTime.MinValue;
            _contractcycle = 0;
            _securityagreementdate = DateTime.MinValue;
            _securityagreementcycle = 0;
            _healthdeclareform = string.Empty;
            _healthdeclaredate = DateTime.MinValue;
            _guarantor = string.Empty;
            _recdivid = string.Empty;
            _recacct = string.Empty;
            _recdate = DateTime.MinValue;
            _void = false;
            _voidacct = string.Empty;
            _voiddate = DateTime.MinValue;
            _useracct = string.Empty;
            _lastupdatedate = DateTime.MinValue;
        }
        /// <summary>
        /// SetModel By DataRow
        /// </summary>
        /// <param name="dr">DataRow</param>
        /// <returns>Drivers</returns>
        private Drivers SetModel(DataRow dr)
        {
            _recid = StrHelper.GetIntValue(dr[FIELD_RecID]);
            _driverid = StrHelper.GetStringValue(dr[FIELD_DriverID]);
            _drivername = StrHelper.GetStringValue(dr[FIELD_DriverName]);
            _driverpic = StrHelper.GetStringValue(dr[FIELD_DriverPic]);
            _companyid = StrHelper.GetStringValue(dr[FIELD_CompanyID]);
            _companyname = StrHelper.GetStringValue(dr[FIELD_CompanyName]);
            _sex = StrHelper.GetStringValue(dr[FIELD_Sex]);
            _birthday = StrHelper.GetDateTimeValue(dr[FIELD_BirthDay]);
            _familyaddress = StrHelper.GetStringValue(dr[FIELD_FamilyAddress]);
            _cellphone = StrHelper.GetStringValue(dr[FIELD_CellPhone]);
            _homephone = StrHelper.GetStringValue(dr[FIELD_HomePhone]);
            _idcardno = StrHelper.GetStringValue(dr[FIELD_IDCardNO]);
            _drivinglicensetype = StrHelper.GetStringValue(dr[FIELD_DrivingLicenseType]);
            _drivinglicensegetdate = StrHelper.GetDateTimeValue(dr[FIELD_DrivingLicenseGetDate]);
            _busidentificationno = StrHelper.GetStringValue(dr[FIELD_BusIdentificationNO]);
            _workcompany = StrHelper.GetStringValue(dr[FIELD_WorkCompany]);
            _worktype = StrHelper.GetStringValue(dr[FIELD_WorkType]);
            _idcardnopic = StrHelper.GetStringValue(dr[FIELD_IDCardNOPic]);
            _drivinglicense = StrHelper.GetStringValue(dr[FIELD_DrivingLicense]);
            _drivingpermit = StrHelper.GetStringValue(dr[FIELD_DrivingPermit]);
            _operationcertificate = StrHelper.GetStringValue(dr[FIELD_OperationCertificate]);
            _specialcertificate = StrHelper.GetStringValue(dr[FIELD_SpecialCertificate]);
            _policestationcertificate = StrHelper.GetStringValue(dr[FIELD_PoliceStationCertificate]);
            _contract = StrHelper.GetStringValue(dr[FIELD_Contract]);
            _contractdate = StrHelper.GetDateTimeValue(dr[FIELD_ContractDate]);
            _contractcycle = StrHelper.GetIntValue(dr[FIELD_ContractCycle]);
            _securityagreementdate = StrHelper.GetDateTimeValue(dr[FIELD_SecurityAgreementDate]);
            _securityagreementcycle = StrHelper.GetIntValue(dr[FIELD_SecurityAgreementCycle]);
            _healthdeclareform = StrHelper.GetStringValue(dr[FIELD_HealthDeclareForm]);
            _healthdeclaredate = StrHelper.GetDateTimeValue(dr[FIELD_HealthDeclareDate]);
            _guarantor = StrHelper.GetStringValue(dr[FIELD_Guarantor]);
            _recdivid = StrHelper.GetStringValue(dr[FIELD_RecDivID]);
            _recacct = StrHelper.GetStringValue(dr[FIELD_RecAcct]);
            _recdate = StrHelper.GetDateTimeValue(dr[FIELD_RecDate]);
            //_void = StrHelper.GetBoolValue(dr[FIELD_Void]);
            //_voidacct = StrHelper.GetStringValue(dr[FIELD_VoidAcct]);
            //_voiddate = StrHelper.GetDateTimeValue(dr[FIELD_VoidDate]);
            _useracct = StrHelper.GetStringValue(dr[FIELD_UserAcct]);
            _lastupdatedate = StrHelper.GetDateTimeValue(dr[FIELD_LastUpdateDate]);
            return this;
        }
        /// <summary>
        /// SetModel By DataTable
        /// </summary>
        /// <param name="dt">DataTable</param>
        /// <returns>Drivers</returns>
        private Drivers SetModel(DataTable dt)
        {
            foreach (DataRow dr in dt.Rows)
            {
                SetModel(dr);
                break;
            }
            return this;
        }
        #endregion --Private--

    }
}

